<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>若依介绍</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
    <link href="../static/css/main/style.min862f.css" th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
</head>

<body class="gray-bg">
<div class="row">
    <div id="mt21tj" class="col-sm-6" style="height: 450px"></div>
</div>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/hruinger/js/echarts/echarts.min.js}"></script>
<script th:inline="javascript"> var ctx = [[@{/}]]; var lockscreen = [[${session.lockscreen}]]; if(lockscreen){window.top.location=ctx+"lockscreen";} </script>
<script type="text/javascript">
    $.when(
        $.getJSON(ctx+'system/goods/getData'),
        $.getJSON(ctx+'system/goods/getCtn')
    ).done(function (dta1,dta2) {
        var myChart = echarts.init(document.getElementById('mt21tj'));
        var dta=dta1[0];
        var tagName=[];
        var tagZje=[];
        var tagGxl=[];
        for(let i = 0;i<dta.length;i++){
            tagName[i]=dta[i].gname;
            tagGxl[i]=dta[i].gxl;
            tagZje[i]=dta[i].zje;
        }
        var option = {
            title: {
                text: '总销量、总金额'+'\n'+'总计: '+dta2[0]
            },
            tooltip: {},
            legend: {
                data: ['总销量', '总金额(元)'],
                verticalAlign: 'middle',
                layout: 'vertical'
            },
            xAxis: {
                data: tagName,
            },
            yAxis: {},
            series: [{
                name: '总销量',
                type: 'bar',
                data: tagGxl
            }, {
                name: '总金额(元)',
                type: 'bar',
                data: tagZje
            }
            ]
        };
        myChart.setOption(option);
    });
</script>
</body>
</html>
